package com.wwtech.epp.ui.activity.work.module;

import com.wwtech.epp.data.api.HttpAPIWrapper;
import com.wwtech.epp.ui.activity.base.ActivityScope;
import com.wwtech.epp.ui.activity.work.NewTaskFragment;
import com.wwtech.epp.ui.activity.work.contract.NewTaskContract;
import com.wwtech.epp.ui.activity.work.presenter.NewTaskPresenter;
import com.wwtech.epp.ui.adapter.work.AttachmentAdapter;

import java.util.ArrayList;

import dagger.Module;
import dagger.Provides;

/**
 * @author hzp
 * @Package com.wwtech.epp.ui.activity.work
 * @Description: The moduele of NewTaskFragment, provide field for NewTaskFragment
 * @date 2017/09/16 16:06:07
 */
@Module
public class NewTaskModule {
    private final NewTaskContract.View mView;


    public NewTaskModule(NewTaskContract.View view) {
        this.mView = view;
    }

    @Provides
    @ActivityScope
    public NewTaskPresenter provideNewTaskPresenter(HttpAPIWrapper httpAPIWrapper, NewTaskFragment mFragment) {
        return new NewTaskPresenter(httpAPIWrapper, mView, mFragment);
    }

    @Provides
    @ActivityScope
    public NewTaskFragment provideNewTaskFragment() {
        return (NewTaskFragment) mView;
    }

    @Provides
    public AttachmentAdapter provideAttachmentAdapter() {
        return new AttachmentAdapter(new ArrayList<>());
    }
}